package com.cjk.console;

import javax.servlet.http.HttpSession;

import com.cjk.console.model.LoginInfo;

public class SessionApi {
	
	private static final String LOGIN = "consoleLoginUser";
	
	public static void setLoginUserInfo(HttpSession session, LoginInfo loginInfo){
		session.setAttribute(LOGIN, loginInfo);
	}
	
	public static void removeLoginUserInfo(HttpSession session){
		session.removeAttribute(LOGIN);
	}

	public static LoginInfo getLoginUserInfo(HttpSession session){
		return (LoginInfo) session.getAttribute(LOGIN);
	}
	
	public static Integer getLoginUserId(HttpSession session){
		return ((LoginInfo) session.getAttribute(LOGIN)).getId();
	}
	
}
